<nav aria-label="Page navigation">
    <ul class="pagination">
        <li class="page-item">
            <a class="page-link" href="?page=0&name=<?echo $name; ?>&username=<? echo $username; ?>" aria-label="Previous">
                <span aria-hidden="true">&laquo;</span>
            </a>
        </li>
        <?php
            for ($i = 0; $i < $userPage->totalPage; $i++) {
                echo '
                <li class="page-item' . 
                    ($userPage->number === $i ? ' active' : '')
                . '"><a class="page-link" href="?page=' . $i . 
                    '&name=' . $name . '&username=' . $username .
                '">'
                    . ($i + 1) .
                '</a></li>
                ';
            }
        ?>
        <li class="page-item">
            <a class="page-link" href="?page=<? 
            echo $userPage->totalPage - 1 . '&name=' . $name . '&username=' . $username;
        ?>" aria-label="Next">
                <span aria-hidden="true">&raquo;</span>
            </a>
        </li>
    </ul>
</nav>